package com.ysyx.ysyx_passengerconfirmo.controller;

import com.ysyx.ysyx_passengerconfirmo.dto.BaseDto;
import com.ysyx.ysyx_passengerconfirmo.qo.TakeOrderQo;
import com.ysyx.ysyx_passengerconfirmo.service.OrderPojoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @description: xxxx接口/类
 * @author:郭宇轩
 * @create:2023/4/11 14:11
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderPojoService orderPojoService;


    /*
     * @Description: (作用)用户下单
     * @params: TakeOrderQo{乘客id：passengerId,
     * 起点经度start_longitude, 起点纬度start_latitude, 起点名start_name,
     * 终点经度end_longitude, 终点纬度end_latitude, 终点名end_name，
     * 里程数mileage}
     *
     * @return:BaseDto(statusCode:101乘客下单成功  201起点区域未开通服务  301终点区域未开通服务
     * list[0]:TakeOrderQo{乘客id：passengerId,订单id orderId
     * 起点经度start_longitude, 起点纬度start_latitude, 起点名start_name,
     * 终点经度end_longitude, 终点纬度end_latitude, 终点名end_name，
     * 里程数mileage,费用cost}
     * )
     *
     * @Author: 郭宇轩
     * @create:2023/4/12
     */

    @RequestMapping("/passenger/takecar")
    public BaseDto takeCar(TakeOrderQo takeOrderQo){
        System.out.println("Controller"+takeOrderQo);
        BaseDto baseDto = orderPojoService.insertOneOrder(takeOrderQo);
        return baseDto;
    };

}
